<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" type="text/css" href="static/js/login/style.css"/>
    <!--框架必需start-->
    <script type="text/javascript" src="static/qui/libs/js/jquery.js"></script>
    <script type="text/javascript" src="static/qui/libs/js/language/cn.js"></script>
    <script type="text/javascript" src="static/qui/libs/js/framework.js"></script>
    <link href="static/qui/libs/css/import_basic.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" id="skin" prePath="../../static/qui/" />
    <link rel="stylesheet" type="text/css" id="customSkin" />
    <script type="text/javascript" src="static/qui/libs/js/popup/toast.js"></script>
    <!--框架必需end-->
</head>
<body>
<div class="win">
    <div class="login_win">
        <h1 style="color: #EEEEEE;margin-top: 150px;font-size: 23px;">职师学院新生寝室大赛信息网后台管理</h1>
        <form onsubmit="return false;" action="" method="post" class="form_win">
            <div class="form_title">
                <span>用户登录</span>
            </div>
            <div class="user">
                <i></i><input type="text"  value="admin" id="username" placeholder="用户名" />
            </div>
            <div class="passerword">
                <i></i><input type="password"  value="123456" id="password" placeholder="密码" />
            </div>
            <div class="remember clear">
                <a href="javascript:;"></a>
            </div>
            <input id="loginBtn" type="submit" value="登 录" class="submit"/>
        </form>
    </div>
</div>
<script type="text/javascript">
    $("#loginBtn").click(function () {
        $.ajax({
            type: "POST",
            url: "/doLogin",
            data: {username:$("#username").val(), password:$("#password").val()},
            success: function(data){
                if(data.success){
                    window.location.href = "/main.jsp";
                }
                else{
                    self.Toast('showWarningToast', data.msg);
                }
            },
            error:function (e) {
                self.Toast("showErrorToast","登录异常！");
            }
        });
    });
    $.getJSON("/checkIsLogin",function (data) {
        if(data){
            window.location.href="/main.jsp";
        }
    })
</script>
</body>
</html>